package com.jltx.storage.downloader.util;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;

/**
 * @author jltxseo
 * @date 2017/09/05.
 */

public class OkhttpClientFactoryUtils {
    private OkHttpClient okHttpClient;

    public OkhttpClientFactoryUtils() {
        OkHttpClient.Builder builder = new OkHttpClient.Builder();
        okHttpClient = builder.connectTimeout(60L, TimeUnit.SECONDS)
                .writeTimeout(60L, TimeUnit.SECONDS)
                .readTimeout(60L, TimeUnit.SECONDS)
                .build();
    }

    public OkHttpClient getOkHttpClient() {
        return okHttpClient;
    }

    public static OkhttpClientFactoryUtils getInstance() {
        return OkhttpClientFactoryHolder.sInstance;
    }


    private static class OkhttpClientFactoryHolder {
        private static final OkhttpClientFactoryUtils sInstance = new OkhttpClientFactoryUtils();
    }
}
